package org.mathcloud.math.core.generic.operator.trigonometry;

import org.mathcloud.math.core.common.operator.trigonometry.Arctanh;
import org.mathcloud.math.core.common.quantity.RealNumber;
import org.mathcloud.math.core.generic.operator.GenericUnaryOperator;
import org.mathcloud.math.core.generic.quantity.GenericRealNumber;

public class GenericArctanh extends GenericUnaryOperator implements Arctanh
{
	public GenericArctanh()
	{
		super();
		signature.setMMLContentTag("arctanh");
	}

	@Override
	public void calculate()
	{
		Double d;
		if (operand.getSignature().isRealNumberSignature()) {
			d= ((RealNumber)operand).getValue();
			res = new GenericRealNumber(Math.log((1.0+d)/(1.0-d))/2.0);
		}
	}
}